import React, { Component } from "react";
import ReactDOM from 'react-dom';
import { store } from "../help/global.js";
import * as actions from "../actions/index.js"

export default class Footer extends Component {

    renderFilter(filter, name) {
        if (filter = this.props.filter) {
            return name
        }
        return (
            <a href="#" style={{ cursor: "pointer" }} onClick={e => {
                e.preventDefault();
                store.dispatch(actions.setVisibilityFilter(filter))
            }}>{name}</a>
        )
    }
    render() {
        return (
            <div>
                <p>
                    展示:
                    {""}
                    <span style={{ cursor: "pointer" }} onClick={e => {
                        e.preventDefault();
                        store.dispatch(actions.setVisibilityFilter("SHOW_ACTIVE"))
                    }}>{"未完成"}</span>
                    {"  |  "}
                    <span style={{ cursor: "pointer" }} onClick={e => {
                        e.preventDefault();
                        store.dispatch(actions.setVisibilityFilter("SHOW_COMPLETED"))
                    }}>{"已完成"}</span>
                    {"  |  "}                    
                    <span style={{ cursor: "pointer" }} onClick={e => {
                        e.preventDefault();
                        store.dispatch(actions.setVisibilityFilter("SHOW_ACTIVE"))
                    }}>{"未完成"}</span>
                </p>
            </div>
        )
    }
}
